home *** CD-ROM | disk | FTP | other *** search
/ PC-X 1997 October / pcx14_9710.iso / swag / strings.swg / 0110_MS-DOS Contry-Specific Upper Case.pas < prev    next >
Encoding:
Pascal/Delphi Source File  |  1995-05-26  |  1.1 KB  |  63 lines

  1. {
  2. > I did, as I said "I couldn't get anything to work". No functions that
  3. > I called returned the expected results, or maybe I wasn't doing something
  4. > correctly, in any case it would be easier if someone was to post
  5. > information on how I do something like this:
  6.  
  7. There is an easy way to convert strings using the national conversion tables
  8. using DOS function $6521 (4.0 up). I'm using these two implementations:
  9.  
  10.   MS-DOS function $6521
  11.   Version 4.0 up
  12.   Converts string at address DS:DX
  13.   of length CX
  14. }
  15.  
  16. procedure cap(var s:string);
  17. { converts string S to uppercase
  18.   procedure version
  19. }
  20. assembler;
  21. asm
  22.   push ds
  23.   lds  si,s
  24.   mov  cl,[si]
  25.   xor  ch,ch
  26.   jcxz @Exit
  27.   lea  dx,[si+1]
  28.   mov  ax,$6521
  29.   int  21h
  30. @Exit:
  31.   pop ds
  32. end;
  33.  
  34. function fcap(s:string):string;
  35. (* TP 7.0
  36. function fcap(const s:string):string;
  37. *)
  38. { converts string S to uppercase
  39.   function version
  40. }
  41. assembler;
  42. asm
  43.   push ds
  44.   lds  si,s
  45.   cld
  46.   lodsb
  47.   mov  cl,al
  48.   xor  ch,ch
  49.   jcxz @Exit
  50.   les  di,@Result
  51.   stosb
  52.   mov  dx,di
  53.   push cx
  54.   rep  movsb
  55.   push es
  56.   pop  ds
  57.   pop  cx
  58.   mov  ax,$6521
  59.   int  21h
  60. @Exit:
  61.   pop ds
  62. end;
  63.